<?
$df="/proc/zaptel";
$files=array();
$span=array();
$table="";
$table=xparse("tpl/zaptel.html");
if ($dir=opendir($df)){
    while (($file=readdir($dir))!==false){
	if ($file=="." || $file=="..") continue;
	if (is_dir("$df/$file"))continue;
    	$files[]=$file;
    }
}
closedir($dir);
sort($files);
$f=file("/etc/zaptel.conf");
foreach($f as $i){
    if(preg_match("!^(#|//)!", $i))continue;
    if(!preg_match("!^span=!", $i))continue;
    $span[]=$i;
}
foreach($files as $i=>$ii){
    $f=fopen("$df/$ii", "r");
    $table.="<tr>"
	."<td style=\"border-right: 1px solid #c0c0c0;border-bottom: 1px solid #c0c0c0\" align=left width=500><font class=class=z11 size=-1>&nbsp;<a href=\"#\" onClick=\"click_sub('pri_','$ii')\">Поток $ii</a></font></td>";
    $table_tmp="<td style=\"border-bottom: 1px solid #c0c0c0\" height=20 align=left width=200><font class=z11 size=-1>&nbsp;<img src=\"/images/no.png\"></font></td>";
    if(!preg_match("!ZTDUMMY!", fread($f, 1024))){
	for($s=0,$max=sizeof($span);$s<$max;$s++){
	    if(preg_match("!^span=$ii,!", $span[$s])){
    	        $table_tmp="<td style=\"border-bottom: 1px solid #c0c0c0\" height=20 align=left width=200><font class=z11 size=-1>&nbsp;<img src=\"/images/yes.png\"</font></td>";
	    }
	}
    }
    $table.=$table_tmp."</tr>";
}
$table=xparse("tpl/e1.html");
?>